//导入request.js
import request from "@/utils/request";//@==>src

const reqComment ={
    // getArticles:async(page,size)=>{
    //    const {data:res} =  await request.get("/articles?page="+page+'&size='+size);
    //    return res;
    // },
    //分页查询评论
    getComments:(reqBody)=>{
       return request.post('/mod03/comments/manger/page',{
           "page":     reqBody.page,
           "size":     reqBody.size,
           "username": reqBody.username,
           "nickname": reqBody.nickname,
           "title":    reqBody.title,
           "content":  reqBody.content
       }).then(res=>{
        return res.data;
       })
    },
    //根据文章id查询评论
     getCommentByArtId:  (id)=>{
        return request.get("/mod03/comments?id="+id).then(res=>{
            //console.log(res.data.data);
            return res.data.data;
        })
    },
    //删除单个评论
    deleteOne:(cid)=>{
        return request.delete(`/mod03/comments/deleteone/${cid}`).then(res=>{
            return res.data;
        })
    },
    //批量删除
    deleteBuch:(cids)=>{
        return request.post('/mod03/comments/deletebuch',{
            "ids":cids
        }).then(res=>{
            return res.data;
        })
    }
}

//可以按需导出
//获取文章列表  方法一  返回一个请求的方法
//export const getArticles = (page,size)=>request.get("/articles/",{page,size});
//获取文章详情
// export const getArticleDetail=(id)=>request.get(`/article/${id}`);
//方法二 在api文件里出来异步请求
// export const getCategory = async()=>{
// 	const res = await request.get(`/category/`);
// 	return res.data.results;
// 	};
export default reqComment;